package com.jeecg.struts.business;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.jeecg.struts.action.Action;
import com.jeecg.struts.form.ActionForm;
import com.jeecg.struts.form.LoginForm;

public class LoginAction  implements Action {

	
	@Override
	public String execute(HttpServletRequest req,ActionForm actionForm,Map<String,String> forwordMap) {
		String url = null ;
		
		LoginForm loginForm =(LoginForm)actionForm;
		String username = loginForm.getUsername();
		String password = loginForm.getPassword();
		if(username.equals("admin") && password.equals("admin")){
			req.setAttribute("form", actionForm); 
			return forwordMap.get("success") ;
		}
		req.setAttribute("ErrorMsg", "value is empty");
		return  forwordMap.get("fail") ;
	}
	

}
